package com.hgsoft.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.hgsoft.dao.BasicParaDao;
import com.hgsoft.entity.BasicPara;
import com.hgsoft.util.Order;
import com.hgsoft.util.Property;

@Service 
public class BasicParaService extends BaseService<BasicPara>{
	
	@Resource(type=BasicParaDao.class)
	public void setDao(BasicParaDao dao){
		super.setDao(dao);
	}
	
	@Override
	public BasicParaDao getDao() {
	    	return (BasicParaDao)super.getDao();
	}
	
	public String findByTag(String tag) {
		List<BasicPara> list = getDao().findAll(Order.desc("id"), Property.eq("tag", tag));
		if (list != null && !list.isEmpty()) {
		    return list.get(0).getValue();
		} else {
		    return null;
		}
	    }
	
}
